package org.jeecg.modules.audit.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.audit.entity.ShortVideoRemarkReply;
import org.jeecg.modules.audit.service.IShortVideoRemarkReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;

/**
* @Description: 短视频评论回复
* @Author: jeecg-boot
* @Date:   2020-05-20
* @Version: V1.0
*/
@Slf4j
@Api(tags="短视频评论回复")
@RestController
@RequestMapping("/video/shortVideoRemarkReply")
public class ShortVideoRemarkReplyController extends JeecgController<ShortVideoRemarkReply, IShortVideoRemarkReplyService> {
   @Autowired
   private IShortVideoRemarkReplyService shortVideoRemarkReplyService;

   /**
    * 分页列表查询
    *
    * @param shortVideoRemarkReply
    * @param pageNo
    * @param pageSize
    * @param req
    * @return
    */
   @AutoLog(value = "短视频评论-分页列表查询")
   @ApiOperation(value="短视频评论-分页列表查询", notes="短视频评论-分页列表查询")
   @GetMapping(value = "/list")
   public Result<?> queryPageList(ShortVideoRemarkReply shortVideoRemarkReply,
                                  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                  HttpServletRequest req) {
       QueryWrapper<ShortVideoRemarkReply> queryWrapper = QueryGenerator.initQueryWrapper(shortVideoRemarkReply, req.getParameterMap());
       Page<ShortVideoRemarkReply> page = new Page<ShortVideoRemarkReply>(pageNo, pageSize);
       IPage<ShortVideoRemarkReply> pageList = shortVideoRemarkReplyService.page(page, queryWrapper);
       return Result.ok(pageList);
   }

   /**
    * 编辑
    *
    * @param shortVideoRemarkReply
    * @return
    */
   @AutoLog(value = "短视频评论-编辑")
   @ApiOperation(value="短视频评论-编辑", notes="短视频评论-编辑")
   @PutMapping(value = "/edit")
   public Result<?> edit(@RequestBody ShortVideoRemarkReply shortVideoRemarkReply) {
       shortVideoRemarkReplyService.updateById(shortVideoRemarkReply);
       return Result.ok("编辑成功!");
   }


   /**
    * 通过id查询
    *
    * @param id
    * @return
    */
   @AutoLog(value = "短视频评论-通过id查询")
   @ApiOperation(value="短视频评论-通过id查询", notes="短视频评论-通过id查询")
   @GetMapping(value = "/queryById")
   public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
       ShortVideoRemarkReply shortVideoRemarkReply = shortVideoRemarkReplyService.getById(id);
       return Result.ok(shortVideoRemarkReply);
   }


}
